﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _2017._02._09_MenuItem
{
    class Program
    {
        static void Main(string[] args)
        {
            List<MenuItem> menues = new List<MenuItem>(7);
            menues.Add(new Beverage());
            menues.Add(new Beverage());
            menues.Add(new Beverage());
            menues.Add(new Beverage());
            menues.Add(new Snack());
            menues.Add(new Snack());
            menues.Add(new Snack());

            foreach (var menu in menues)
            {
                menu.PrintToConsole();
                Console.WriteLine();
            }

            Console.ReadKey();
        }
    }

    class MenuItem
    {
        
        public string Name { get; private set; }

        public MenuItem()
        {
            string name = Console.ReadLine();
            if (String.IsNullOrWhiteSpace(name))
                throw new ArgumentException();
            Name = name;
        }

        public virtual void PrintToConsole()
        {

        }
            
    }

    class Beverage: MenuItem
    {
        private double small;
        private double medium;
        private double large;
        public double Small
        {
            get { return small; }
            private set
            {
                if (value < 0)
                    throw new ArgumentException();
                small = value;
            }
        }
        public double Medium
        {
            get { return medium; }
            private set
            {
                if (value < 0)
                    throw new ArgumentException();
                medium = value;
            }
        }
        public double Large
        {
            get { return large; }
            private set
            {
                if (value < 0)
                    throw new ArgumentException();
                large = value;
            }
        }

        public Beverage()
        {
            double small = Int32.Parse(Console.ReadLine());
            double medium = Int32.Parse(Console.ReadLine());
            double large = Int32.Parse(Console.ReadLine());
            Small = small;
            Medium = medium;
            Large = large;
        }

        public override void PrintToConsole()
        {
            Console.WriteLine("{0} -- Small: {1}, Medium: {2}, Large: {3}", Name, Small, Medium, Large);
        }

    }


    class Snack: MenuItem
    {
        public double Price { get; private set; }

        public Snack()
        {
            double price = Int32.Parse(Console.ReadLine());
            Price = price;
        }

        public override void PrintToConsole()
        {
            Console.WriteLine("{0} -- Price: {1}", Name, Price);
        }
    }


}
